<!-- 员工注册成功页面 client_registered_success.php -->
<!DOCTYPE html>
<html>

<head>
    <title> 员工注册 | 租车服务 </title>
    <link rel="shortcut icon" type="image/png" href="assets/img/P.png.png">
</head>

<link rel="stylesheet" type="text/css" href="assets/css/manager_registered_success.css">
<link rel="stylesheet" type="text/css" href="assets/bootstrap/css/bootstrap.min.css">
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>

<body>

    <!--返回顶部按钮..................................................................................-->
    <button onclick="topFunction()" id="myBtn" title="返回顶部">
        <span class="glyphicon glyphicon-chevron-up"></span>
    </button>
    <!--返回顶部按钮的JavaScript代码....................................................................-->
    <script type="text/javascript">
        window.onscroll = function() {
            scrollFunction()
        };

        function scrollFunction() {
            if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
                document.getElementById("myBtn").style.display = "block";
            } else {
                document.getElementById("myBtn").style.display = "none";
            }
        }

        function topFunction() {
            document.body.scrollTop = 0;
            document.documentElement.scrollTop = 0;
        }
    </script>

    <!-- 导航栏 -->
    <?php
    include './nav.php';
    ?>

    <?php
    // 导入数据库连接
    require 'connection.php';
    // 连接数据库
    $conn = Connect();

    // 获取表单数据
    $client_name = $conn->real_escape_string($_POST['client_name']);
    $client_username = $conn->real_escape_string($_POST['client_username']);
    $client_email = $conn->real_escape_string($_POST['client_email']);
    $client_phone = $conn->real_escape_string($_POST['client_phone']);
    $client_address = $conn->real_escape_string($_POST['client_address']);
    $client_password = $conn->real_escape_string($_POST['client_password']);

    // 构建插入查询语句
    $query = "INSERT INTO clients(client_name, client_username, client_email, client_phone, client_address, client_password)
                  VALUES('" . $client_name . "','" . $client_username . "','" . $client_email . "','"
        . $client_phone . "','" . $client_address . "','" . $client_password . "')";
    // 执行查询
    $success = $conn->query($query);

    // 如果插入失败
    if (!$success) {
        die("无法插入数据: " . $conn->error);
    }

    // 关闭数据库连接
    $conn->close();
    ?>

    <div class="container">
        <div class="jumbotron" style="text-align: center;">
            <h2> <?php echo "欢迎 $client_name!" ?> </h2>
            <h1>您的帐户已创建。</h1>
            <p>现在从 <a href="clientlogin.php">这里</a> 登录。</p>
        </div>
    </div>

</body>
<footer class="site-footer">
    <div class="container">
        <hr>
        <div class="row">
            <div class="col-sm-6">
                <h5>© <?php echo date("Y"); ?> 租车服务</h5>
            </div>
        </div>
    </div>
</footer>

</html>